//
//  WBEmoticon.swift
//  SainMicroblog
//
//  Created by chenxinju on 16/5/14.
//  Copyright © 2016年 chenxinju-a2. All rights reserved.
//

import UIKit

class WBEmoticon: NSObject {

   
    
    /// emoji 十六进制
    var code: String?{
        
        didSet{
            
            // 1. 创建一个扫描类
            let scanner = NSScanner(string: code!)
            // 2.
            var result: UInt32 = 0
            scanner.scanHexInt(&result)
            // 3. 把resulst 转换成 unicode
            let unicode = UnicodeScalar(result)
            // 4. 把 unicode转换成 Character
            let character = Character(unicode)
            
            emoji = "\(character)"
            
        }
        
    }
    /// 用于发布微博时候,我们发布的微博表情,并不是图片,而是这个字端
    var chs: String?
    /// 图片的名字
    var png: String?
    ///  我需要包的路径,而且是绝对路径
    var package: String?
    
    var emoji: String?
    
    init(dic: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dic)
//        print(dic["png"])
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }

}
